import request from '@/utils/request'

// 分页查询分类
export function listCategory(query) {
  return request({
    url: '/category/page',
    method: 'get',
    params: query
  })
}

// 查询单个分类
export function getCategory(id) {
  return request({
    url: `/category/${id}`,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/category',
    method: 'post',
    data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/category',
    method: 'put',
    data
  })
}

// 删除分类
export function delCategory(id) {
  return request({
    url: `/category/${id}`,
    method: 'delete'
  })
} 